#
import numpy as np
import torch
import torch.nn as nn

class WfsConfig(object):
    def __init__(self):
        self.name = 'apps.wfs.wfs_config.WfsConfig'
    
    c = 3E8
    N = 8
    f = 300.0E6
    d = 0.5 * (c/f)
    theta = 5.0
    x_min, x_max, x_nums = -torch.pi/2.0, torch.pi/2.0, 1000
    thetas = None
    x_scale = (x_max - x_min) / x_nums
    device = 'cpu'

    @staticmethod
    def initialize() -> None:
        WfsConfig.thetas = torch.from_numpy(np.linspace(WfsConfig.x_min, WfsConfig.x_max, WfsConfig.x_nums)) # 定义绘制扫描角度与天线因子图时横坐标扫描角度的范围
        WfsConfig.thetas = WfsConfig.thetas.float()
        WfsConfig.thetas = WfsConfig.thetas.to(torch.float64)
        WfsConfig.thetas.requires_grad = True
        WfsConfig.device = 'cuda' if torch.cuda.is_available() else 'cpu'
        WfsConfig.thetas = WfsConfig.thetas.to(WfsConfig.device)